import request from "@/utils/request";
import type { GetRolePermissionApiResponse } from "./model/roleModel";
import type { AddOrUpdatePermissionApiParams } from "./model/permissionModel";
enum api {
  getPermission = "/admin/acl/permission",
  addPermission = "/admin/acl/permission/save",
  updatePermission = "/admin/acl/permission/update",
  removePermission = "/admin/acl/permission/remove",
}
/**
 * 获取权限菜单的请求
 * @returns GetRolePermissionApiResponse
 */
export const getPermissionApi = () => {
  return request.get<any, GetRolePermissionApiResponse>(api.getPermission);
};
/**
 * 添加菜单的请求
 * @param data AddOrUpdatePermissionApiParams
 * @returns null
 */
export const addPermissionApi = (data: AddOrUpdatePermissionApiParams) => {
  return request.post<any, null>(api.addPermission, data);
};
/**
 * 修改菜单的请求
 * @param data AddOrUpdatePermissionApiParams
 * @returns null
 */
export const updatePermissionApi = (data: AddOrUpdatePermissionApiParams) => {
  return request.put(api.updatePermission, data);
};
/**
 * 删除菜单的请求
 * @param id
 * @returns null
 */
export const removePermissionApi = (id: string) => {
  return request.delete<any, null>(api.removePermission + `/${id}`);
};
